﻿
namespace Tatibah
{
#pragma warning disable 1591
    public enum enumCellContentType
    {
        Image,
        Paragraph,
        NumberedList,
        Table
    }
#pragma warning restore 1591

    /// <summary>
    /// Internal Class used to define the contents of a Cell
    /// </summary>
    public class CellContent
    {
        /// <summary>
        /// The content type
        /// </summary>
        public enumCellContentType ContentType;
        private object Object = null; // Actual storage of the content

        #region C O N S T R U C T O R S
        /// <summary>
        /// Contruct a Cell Content from a Paragraph
        /// </summary>
        /// <param name="ThisParagraph"></param>
        public CellContent(Paragraph ThisParagraph)
        {
            ContentType = enumCellContentType.Paragraph;
            Object = ThisParagraph;
        }

        /// <summary>
        ///  Contruct a Cell Content from a Table
        /// </summary>
        /// <param name="ThisTable"></param>
        public CellContent(Table ThisTable)
        {
            ContentType = enumCellContentType.Table;
            Object = ThisTable;
        }

        /// <summary>
        ///  Contruct a Cell Content from an Image
        /// </summary>
        /// <param name="ThisImage"></param>
        public CellContent(Image ThisImage)
        {
            ContentType = enumCellContentType.Image;
            Object = ThisImage;
        }

        /// <summary>
        ///  Contruct a Cell Content from a NumberedList
        /// </summary>
        /// <param name="ThisNumberedList"></param>
        public CellContent(NumberedList ThisNumberedList)
        {
            ContentType = enumCellContentType.NumberedList;
            Object = ThisNumberedList;
        }
        #endregion C O N S T R U C T O R S

        #region P R O P E R T I E S

        /// <summary>
        /// Get the Paragraph stored in this content
        /// </summary>
        public Paragraph Paragraph
        {
            get 
            {
                if (ContentType == enumCellContentType.Paragraph)
                    return (Paragraph) Object;
                else
                    return null;
            }
        }

        /// <summary>
        ///  Get the Image stored in this content
        /// </summary>
        public Image Image
        {
            get 
            {
                if (ContentType == enumCellContentType.Image)
                    return (Image) Object;
                else
                    return null;
            }
        }

        /// <summary>
        ///  Get the Table stored in this content
        /// </summary>
        public Table Table
        {
            get 
            {
                if (ContentType == enumCellContentType.Table)
                    return (Table) Object;
                else
                    return null;
            }
        }

        /// <summary>
        ///  Get the NumberedList stored in this content
        /// </summary>
        public NumberedList NumberedList
        {
            get
            {
                if (ContentType == enumCellContentType.NumberedList)
                    return (NumberedList)Object;
                else
                    return null;
            }
        }

        #endregion P R O P E R T I E S
    }
}
